package com.ncr.travel.appmgr.client.gin;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Singleton;
import com.ncr.travel.appmgr.client.AppController;
import com.ncr.travel.appmgr.client.Constants;
import com.ncr.travel.appmgr.client.model.ApplicationConfigurationFactory;
import com.ncr.travel.appmgr.client.model.ScreenConfigurationFactory;
import com.ncr.travel.appmgr.client.mvp.Presenter;
import com.ncr.travel.appmgr.client.presenter.FunctionPresenter;
import com.ncr.travel.appmgr.client.presenter.FunctionPresenterImpl;
import com.ncr.travel.appmgr.client.presenter.GraphicsEditorPresenter;
import com.ncr.travel.appmgr.client.presenter.GraphicsEditorPresenterImpl;
import com.ncr.travel.appmgr.client.presenter.MainWindowPresenter;
import com.ncr.travel.appmgr.client.presenter.MainWindowPresenterImpl;
import com.ncr.travel.appmgr.client.presenter.RulePresenter;
import com.ncr.travel.appmgr.client.presenter.RulePresenterImpl;
import com.ncr.travel.appmgr.client.presenter.TextPresenter;
import com.ncr.travel.appmgr.client.presenter.TextPresenterImpl;
import com.ncr.travel.appmgr.client.service.AppManagerWebService;
import com.ncr.travel.appmgr.client.service.AppManagerWebServiceImpl;
import com.ncr.travel.appmgr.client.service.MockWebServiceImpl;
import com.ncr.travel.appmgr.client.view.CategoryAndScreenView;
import com.ncr.travel.appmgr.client.view.CategoryAndScreenWidget;
import com.ncr.travel.appmgr.client.view.FunctionView;
import com.ncr.travel.appmgr.client.view.FunctionWidget;
import com.ncr.travel.appmgr.client.view.GraphicsEditorView;
import com.ncr.travel.appmgr.client.view.GraphicsEditorWidget;
import com.ncr.travel.appmgr.client.view.MainCompositeView;
import com.ncr.travel.appmgr.client.view.MainCompositeViewImpl;
import com.ncr.travel.appmgr.client.view.RuleView;
import com.ncr.travel.appmgr.client.view.RuleWidget;
import com.ncr.travel.appmgr.client.view.TextView;
import com.ncr.travel.appmgr.client.view.TextWidget;
import com.ncr.travel.appmgr.style.client.gin.AppManagerStyleGinModule;

public class Module extends AbstractGinModule {

	@Override
	protected void configure() {

		//Other Modules
		install(new com.ncr.travel.appmgr.client.gin.BaseModule());
		install(new AppManagerStyleGinModule());

		//Presenters
		bind(Presenter.class).to(AppController.class).in(Singleton.class);
		bind(MainWindowPresenter.class).to(MainWindowPresenterImpl.class).in(Singleton.class);
		bind(FunctionPresenter.class).to(FunctionPresenterImpl.class).in(Singleton.class);
		bind(GraphicsEditorPresenter.class).to(GraphicsEditorPresenterImpl.class).in(Singleton.class);
		bind(RulePresenter.class).to(RulePresenterImpl.class).in(Singleton.class);
		bind(TextPresenter.class).to(TextPresenterImpl.class).in(Singleton.class);
		
		//Views
		bind(MainCompositeView.class).to(MainCompositeViewImpl.class).in(Singleton.class);
//		bind(MainWindowView.class).to(MainWindowViewImpl.class).in(Singleton.class);
		bind(CategoryAndScreenView.class).to(CategoryAndScreenWidget.class);
		bind(FunctionView.class).to(FunctionWidget.class).in(Singleton.class);
		bind(GraphicsEditorView.class).to(GraphicsEditorWidget.class).in(Singleton.class);
		bind(RuleView.class).to(RuleWidget.class).in(Singleton.class);
		bind(TextView.class).to(TextWidget.class).in(Singleton.class);
		
		//Services
		if (Constants.MOCK_SERVER_MODE) {
			bind(AppManagerWebService.class).to(MockWebServiceImpl.class).in(Singleton.class);
		} else {
			bind(AppManagerWebService.class).to(AppManagerWebServiceImpl.class).in(Singleton.class);
		}
		bind(ApplicationConfigurationFactory.class).in(Singleton.class);
		bind(ScreenConfigurationFactory.class).in(Singleton.class);
	}

}
